using Mapster;
using System.ComponentModel.DataAnnotations;

namespace SmartCommunity.WebApi.Services.System
{
    #region DTO属性映射
    /// <summary>
    /// 属性映射 DictItemDtoRegister
    /// </summary>
    public class DictItemDtoRegister : IRegister
    {
        public void Register(TypeAdapterConfig config)
        {
            // config.ForType<DictItemEntity, DictItemDto>().Map(d => d.DeptName, s => s.Dept.DeptName, s => s.Dept != null);
        }
    }
    #endregion

    #region 数据传输对象 DictItemDto
    /// <summary>
    /// 数据传输对象：字典明细
    /// </summary>
    public class DictItemDto : BaseDto
    {
        /// <summary>
        /// 字典明细ID
        /// </summary>
        public int DictItemId { get; set; }

        /// <summary>
        /// 字典ID
        /// </summary>
        public int DictId { get; set; }

        public string DictType = string.Empty;
        public string DictName = string.Empty;

        /// <summary>
        /// 字典编码
        /// </summary>
        [Required(ErrorMessage = "字典编码不能为空")]
        [StringLength(50, ErrorMessage = "字典编码 长度不能超过 50.")]
        public string DictCode { get; set; } = string.Empty;

        /// <summary>
        /// 字典键值
        /// </summary>
        [Required(ErrorMessage = "字典键值不能为空")]
        [StringLength(100, ErrorMessage = "字典键值 长度不能超过 100.")]
        public string DictValue { get; set; } = string.Empty;

        /// <summary>
        /// 字典标签
        /// </summary>
        [Required(ErrorMessage = "字典标签不能为空")]
        [StringLength(50, ErrorMessage = "字典标签 长度不能超过 50.")]
        public string DictLabel { get; set; } = string.Empty;

        /// <summary>
        /// 排序号
        /// </summary>
        public short? SortNo { get; set; }

        /// <summary>
        /// 备注说明
        /// </summary>
        [StringLength(255, ErrorMessage = "备注说明 长度不能超过 255.")]
        public string? Remark { get; set; }

        /// <summary>
        /// 是否作废
        /// </summary>
        public bool Disabled { get; set; }

    }
    #endregion
}
